#!/usr/bin/env python
# -*- coding:utf-8 -*-
#

import socket
import threading
import socketserver
import json

if __name__ == "__main__":
    # Port 0 means to select an arbitrary unused port

    # msg1 = [{'src':"zj", 'dst':"zjdst"}]
    # msg2 = [{'src':"ln", 'dst':"lndst"}]
    # msg3 = [{'src':"xj", 'dst':"xjdst"}]

    # jmsg1 = json.dumps(msg1)
    # jmsg2 = json.dumps(msg2)
    # jmsg3 = json.dumps(msg3)

    # client(HOST, PORT, jmsg1)
    # client(HOST, PORT, jmsg2)
    # client(HOST, PORT, jmsg3)

    # for i in range(10000):
    HOST, PORT = "localhost", 20001
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect((HOST, PORT))
    msg = [{
        "request": 1
    }]
    jmsg = json.dumps(msg)
    sock.sendall(jmsg.encode("utf-8"))
    sock.sendall(jmsg.encode("utf-8"))
    sock.close()
